import Lazyload from './Lazyload';

const VueLazyload = {
  install(Vue, options) {
    //lazyClass 是一个lazy类
    //便于扩展
    const LazyClass = Lazyload(Vue);
    //实例化lazy类并传入配置options
    const lazyload = new LazyClass(options);

    Vue.directive('lazy', {
      //自定义的方法bindLazy
      //将本来bind(el,bindings,vnodes){}的构造函数转为其他地方编写
      bind: lazyload.bindLazy.bind(lazyload)
    });
  }
}

export default VueLazyload;